﻿using Microsoft.EntityFrameworkCore;

namespace CommonInitializer
{
    public static class DbContextOptionsBuilderFactory
    {
        public static DbContextOptionsBuilder<TDbContext> Create<TDbContext>()
            where TDbContext : DbContext
        {
            var optionsBuilder = new DbContextOptionsBuilder<TDbContext>();

            var connStr = Environment.GetEnvironmentVariable("DefaultDB:ConnStr")!;
            optionsBuilder.UseNpgsql(connStr);

            return optionsBuilder;
        }
    }
}